package Reflection;

import java.lang.reflect.Field;

/**
 * Created by admin on 2016-10-28.
 */
public class operateField {
    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        Class clazz="".getClass();

        Object obj=clazz.newInstance();

        try {
            Field field=clazz.getDeclaredField("hash");
            field.setAccessible(true);

            System.out.println(((String)obj).hashCode());
            field.set(obj,1111);

            System.out.println(field.get(obj));
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
    }
}
